<?php
/**
 * 多媒体模块，视频、音乐
 * @param 
 * @return
 * @author fucaixie
 * @package /application/controller/
 */
require_once MB_CTRL_DIR.'/base_mod.class.php';

class MediaMod extends BaseMod
{	
	/**
	 * 获取视频信息
	 * @return unknown_type
	 */
	public function getVideoInfo()
	{
		$data = array();
		$url=$_POST["url"];
		try
		{		$p=array("url"=>$url);
				$videoInfo=MBGlobal::getApiClient()->getVideoInfo($p);	
				echo($videoInfo);
		}
		catch(MBException $e)
		{
			$data["message"] = array("type"=>"error", "text"=>$e->getMessage());
		}
		
		return;
	}
	/**
	 * 获取音乐信息
	 * @return unknown_type
	 */
	public function getMusicInfo()
	{	if(!isset($_GET["w"])||$_GET["w"]=="")
		{return;}
		if(isset($_GET["p"]))
		{$p=intval($_GET["p"]);}
		else
		{$p=1;}
		$w=urlencode($_GET["w"]);
		$cgiurl="http://cgi.music.soso.com/fcgi-bin/fcg_search_xmldata.q";
		$params=array("uin"=>"",
		"w"=>$w,
		"p"=>$p,
		"perpage"=>5,
		"source"=>10,
		"r"=>1302856367027);
		$querystr="";
		foreach($params as $key => $p)
		{
		 $querystr.=$key."=".$p."&";
		}
		$querystr.="ie=utf-8";
		$result=file_get_contents($cgiurl."?".$querystr);
		$result=iconv("GB2312","UTF-8//IGNORE",$result);
		echo($result);
		return;	
	}
	
	
	/**
	 * (设置)用户信息
	 * @return unknown_type
	 */
	public function addVideo()
	{	
	}
}
?>